package com.card.db.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.card.db.entity.User;

import java.util.List;

/**
 * 数据访问层
 */
@Dao
public interface UserDao {

    /**
     * 插入
     * @param users
     */
    @Insert
    void insertUser(User ...users);


    /**
     * 根据到电话号码查询用户
     * @param telephone
     */
    @Query("select * from user where telephone = :telephone")
    List<User> queryUser(String telephone);

    /**
     * 修改用户
     * @param users
     */
    @Update
    void updateUser(User ...users);

    @Query("select * from user")
    List<User> queryAllUsers();
}
